﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using lauimini_webform.BLL;
using Newtonsoft.Json;
using lauimini_webform.Models;
using System.Web.SessionState;

namespace lauimini_webform.Handle
{
    /// <summary>
    /// table 的摘要说明
    /// </summary>
    public class table : IHttpHandler, IReadOnlySessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
           
            string userAccount = context.Session["userAccount"].ToString();
            int userid = new UserService().getUserid(userAccount);
            List<UserTarget> userTargets = new UserTargetService().getNoFinishMyTarget(userid);
            formatData formatData =new formatData();
            formatData.data = new List<UserTarget>();
            formatData.data = userTargets;
            string json = JsonConvert.SerializeObject(formatData);
        
            context.Response.Write(json);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}